#ifndef __BSP_UART_H
#define	__BSP_UART_H

#include <stdint.h>
#include "stm32f10x.h"

typedef enum
{
	COM1 = 1,
	COM2 = 2,
	COM3 = 3,
	COM4 = 4,
	COM5 = 5,
}tUartCOMx;

typedef enum
{
	UART_OK = 0,
	UART_PARAM_ERR = 1,
}tUartReturnCodes;


typedef struct _UART_CONFIG
{
	USART_TypeDef* USARTx;
	uint32_t UART_PORT_CLK;
	uint32_t UART_CLK;
	uint32_t UART_DMA_CLK;
	GPIO_TypeDef* UART_TX_PORT;
	uint16_t UART_TX_PIN;
	GPIO_TypeDef* UART_RX_PORT;
	uint16_t UART_RX_PIN;
	
	uint8_t UART_DMA_EN;
	DMA_Channel_TypeDef* UART_TX_DMA_Channel;
	DMA_Channel_TypeDef* UART_RX_DMA_Channel;
	uint32_t DMA_PeripheralAddr;
	uint32_t UART_DMA_FLAG;
	
}UART_CONFIG;

typedef struct _UART_PARAM
{
	uint32_t baudrate;
	
}UART_PARAM;


uint8_t UART_Init(uint8_t COMx, uint32_t baud);
void UART_DMA_Config(uint8_t COMx, uint8_t *rx_buff, uint32_t rx_bsize);
void USART_SendNData(USART_TypeDef* USARTx, uint8_t * Data, uint16_t len);
void USART_SendByte(USART_TypeDef* USARTx, uint8_t Data);
void USART_printf(USART_TypeDef* USARTx, char *fmt, ...);




#endif	/* __BSP_UART_H */

